﻿$(function() {
    $('#dlg-historycash').dialog('close');
    $('#dlg-historycashdetail').dialog('close');
});

function histroycash_show() {
    var seleced = $('#floor').floor('getSelectedRoomData');
    if (seleced) {
        $('#dlg-historycash').dialog('open');

        $('#chargelistGird').datagrid('options').url = "../Controller.aspx?controller=RoomBrowseController&method=GetHistoryChargeList&srccId=" + seleced.srccId;
        $('#chargelistGird').datagrid('reload');
    }
}

function btn_cashdetail_show() {
    var selected=$('#chargelistGird').datagrid('getSelected');
    if (selected) {
        $('#dlg-historycashdetail').dialog('open');
        $('#chargedetaillistGird').datagrid('options').url = "../Controller.aspx?controller=RoomBrowseController&method=GetChargeDetailList&chargeId=" + selected.ChargeID;
        $('#chargedetaillistGird').datagrid('reload');
    }
}

function btn_cancelcash() {//取消收银
     var selected=$('#chargelistGird').datagrid('getSelected');
     if (selected) {
         if (parseInt(selected.ChargeFlag) == 1) {
             $.messager.alert('提示', "此条收银记录已被取消结算！", 'info');
             return false;
         }
         
         $.messager.confirm('询问', '是否真的取消此条收银记录？', function(r) {
             if (r) {
                 requestAjax('../Controller.aspx?controller=RoomBrowseController&method=CancelCharge', { chargeId: selected.ChargeID }, function(data) {
                     $('#chargelistGird').datagrid('reload');
                 });
             }
         });
     }
}